package com.roadjava.rbac.mapper;

import com.roadjava.rbac.bean.entity.IndexRes;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IndexResMapper {

    @Insert("INSERT INTO index_res (name, path,link,type) VALUES (#{name}, #{path},#{link},#{type})")
    void insert(IndexRes indexRes);

    @Select("SELECT * FROM index_res")
    List<IndexRes> getAllFiles();

    @Select("SELECT * FROM index_res WHERE id = #{id}")
    IndexRes getFileById(Integer id);

    @Delete("DELETE FROM index_res WHERE id = #{id}")
    void deleteFileById(Integer id);
    @Select("SELECT * FROM index_res WHERE type = #{param}")
    List<IndexRes> getResByType(Integer param);
}
